/*
 * Copyright ©2021 su binglun(9085309@qq.com). All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 *---------------------------------------------------------------------
 *-                                                                   -
 *-           Website : http://phoenix.sunny360.cn/                   -
 *-                                                                   -
 *---------------------------------------------------------------------
 */
package cn.sunny360.core.service;

import cn.sunny360.core.common.PhResult;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;
import io.vertx.core.Promise;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;

import java.util.List;

/**
 * A service interface managing User.
 *
 * @author subl
 */
public interface UserService {

  UserService doLogin(JsonObject jsonUser, Promise<JsonObject> resultHandler);
  
  UserService wsConnection(Long userId, String token, Promise<Boolean> resultHandler);
  
  UserService getTokenByUserId(Long userId, Promise<String> resultHandler);

  UserService getOnlineUserList(Long userId, Promise<JsonArray> resultHandler);
  
  UserService wsDisconnection(String token, Promise<String> resultHandler);
  
  UserService checkOnlineStatus(Long userId, Promise<String> resultHandler);
  
  UserService updateLastVersion(Long userId, Long version, Promise<Long> resultHandler);

  UserService getUserInfoById(Long userId, Promise<JsonObject> handler);

  UserService getUserInfoByName(String username, Promise<JsonObject> resultHandler);

  UserService createUser(JsonObject user, Promise<PhResult> resultHandler);

  UserService addRole(String roleName, String comment, Promise<PhResult> result);

  UserService getUserListByRole(Long roleId, Promise<List<JsonObject>> result);

  UserService updateUser(JsonObject user, Promise<PhResult> resultHandler);

  UserService getUserLastVersion(Long userId, Promise<Long> lastVersionPromise);

  UserService addLoginLog(JsonObject logInfo, Promise<PhResult> resultPromise);

  UserService queryUserByToken(String token, Promise<Boolean> resultPromise);

}

